package com.wind.trademark.notice.controller;


import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wind.trademark.common.vo.PageBean;
import com.wind.trademark.common.vo.PageParam;
import com.wind.trademark.notice.model.NoNotice;
import com.wind.trademark.notice.service.NoticeService;

@Controller
public class NoticeController {
	@Autowired
	private NoticeService  noticeService ;

	private static final Log log = LogFactory.getLog(NoticeController.class);

	@RequestMapping
	public @ResponseBody  NoNotice loadNotice(Long id){
		return noticeService.loadNoticeWithoutLazy(id);
	}
	@RequestMapping
	public @ResponseBody  List<Map<String, Object>> loadNoticeMobileList(){
		return noticeService.loadNoticeMobileList();
	}
	@RequestMapping
	public @ResponseBody  List<Map<String, Object>> loadNoticeEmailList(){
		return noticeService.loadNoticeEmailList();
	}
	@RequestMapping
	public @ResponseBody
	NoNotice saveOrUpdateNotice(@RequestBody NoNotice noNotice) {
		return noticeService.saveOrUpdateNotice(noNotice);

	}
	@RequestMapping
	public @ResponseBody
	NoNotice sendNotice(@RequestBody NoNotice noNotice) {
		return noticeService.sendNotice(noNotice);

	}
	
	
	@RequestMapping
	public @ResponseBody
	Long[] deleteNotices(Long[] ids) {
		noticeService.deleteNotices(Arrays.asList(ids));
		 return ids;
	}
	@RequestMapping
	public @ResponseBody
	PageBean queryNotice(PageParam pageParam,
			@RequestParam Map<String, Object> params) {
		params.put("createBy", 1);
		PageBean pageBean = noticeService.queryNotice(pageParam, params);
		return pageBean;
	}
	 
}
